﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="admin_pic.aspx.cs" Inherits="admin_pic" MasterPageFile="~/Admin.master"%>
<asp:Content  ContentPlaceHolderID="main_style" runat="server">
    <link href="Styles/album.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ContentPlaceHolderID="main_left" runat="server">
    <form id="form1" runat="server">
    <h1>图片管理</h1>
    <br/>
    <asp:GridView ID="GridView1" DataSourceID="mysource" DataKeyNames="id" 
        AutoGenerateEditButton="True" AutoGenerateDeleteButton="True" runat="server" 
        Width="800px" AllowPaging="True" AllowSorting="True" 
        AutoGenerateColumns="False" BackColor="White" BorderColor="#DEDFDE" 
        BorderStyle="None" BorderWidth="1px" CellPadding="4" ForeColor="Black" 
        GridLines="Vertical">
        <AlternatingRowStyle BackColor="White" />
        <Columns>
            <asp:BoundField DataField="id" HeaderText="图片id" InsertVisible="False" 
                ReadOnly="True" SortExpression="id"  />
            <asp:BoundField DataField="uid" HeaderText="用户id" SortExpression="uid" ReadOnly="true"/>
            <asp:BoundField DataField="desp" HeaderText="描述" SortExpression="desp" />
            <asp:BoundField DataField="aid" HeaderText="相册id" SortExpression="aid" ReadOnly="true"/>
            <asp:ImageField HeaderText="图片" DataAlternateTextField="picture" DataImageUrlField="picture" ReadOnly="true">
                <ControlStyle Height="50px" />
            </asp:ImageField>
            <asp:BoundField DataField="time" HeaderText="上传时间" SortExpression="time" ReadOnly="true"/>
            <asp:BoundField DataField="state" HeaderText="是否封面（1为是）" 
                SortExpression="state" />
        </Columns>

        <FooterStyle BackColor="#CCCC99" />
        <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
        <RowStyle BackColor="#F7F7DE" />
        <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
        <SortedAscendingCellStyle BackColor="#FBFBF2" />
        <SortedAscendingHeaderStyle BackColor="#848384" />
        <SortedDescendingCellStyle BackColor="#EAEAD3" />
        <SortedDescendingHeaderStyle BackColor="#575357" />

    </asp:GridView>
    <asp:SqlDataSource ID="mysource" runat="server" 
        ConnectionString="<%$ ConnectionStrings:photoGalleryConnectionString %>" 
        DeleteCommand="DELETE FROM [picture] WHERE [id] = @id" 
        SelectCommand="SELECT [id], [uid], [desp], [aid], [picture], [time], [state] FROM [picture]" 
        UpdateCommand="UPDATE [picture] SET  [desp] = @desp, [state] = @state WHERE [id] = @id">
        <DeleteParameters>
            <asp:Parameter Name="id" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="desp" Type="String" />
            <asp:Parameter Name="state" Type="String" />
            <asp:Parameter Name="id" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
    </form>
</asp:Content>
<asp:Content ContentPlaceHolderID="main_right" runat="server">
    <div id="uploadlink" class="rblock" runat="server">
        <div class="title1">&gt;<a href="admin_pic.aspx">图片管理</a></div>
        <div class="title1">&gt;<a href="admin_usermgr.aspx">用户管理</a></div>
        <div class="title1">&gt;<a href="admin_message.aspx">消息管理</a></div>
        <div class="title1">&gt;<a href="admin_personal.aspx">修改密码</a></div>
    </div>
</asp:Content>